<?php

// 应用公共文件
const _doadminName = "信用查询系统";
const _doadmin="http://zx.yinglinet.cn/";
//微信默认头像

const _wx_default_head_img = "http://dump.fuls.top/default.jpg";
const _wx_default_nickname = "微信用户";
const _sht12=[
    "水瓶座、1.20-2.18",
    "双鱼座、2.19-3.20",
    "白羊座、3.21-4.19",
    "金牛座、4.20-5.20",
    "双子座、5.21-6.21",
    
    "巨蟹座、6.22-7.22",
    "狮子座、7.23-8.22",
    "处女座、8.23-9.22",
    "天秤座、9.23-10.23",
    "天蝎座、10.24-11.22",
    "射手座、11.23-12.21",
    "摩羯座、12.22-1.19"
];
const _sht12_sn=[
    ["name"=> "水瓶座","a1"=>1.20,"a2"=>2.18],
   ["name"=> "双鱼座","a1"=>2.19,"a2"=>3.20],
    ["name"=> "白羊座","a1"=>3.21,"a2"=>4.19],
    ["name"=> "金牛座","a1"=>4.20,"a2"=>5.20],
    ["name"=> "双子座","a1"=>5.21,"a2"=>6.21],
    
    ["name"=> "巨蟹座","a1"=>6.22,"a2"=>7.22],
    ["name"=> "狮子座","a1"=>7.23,"a2"=>8.22],
   ["name"=> "处女座","a1"=>8.23,"a2"=>9.22],
    ["name"=> "天秤座","a1"=>9.23,"a2"=>10.23],
    ["name"=> "天蝎座","a1"=>10.24,"a2"=>11.22],
    ["name"=> "射手座","a1"=>11.23,"a2"=>12.21],
    ["name"=> "摩羯座","a1"=>12.22,"a2"=>13.19],
];
const _shart=[
    "resgt1"=>"基本信息",
    "resgt2"=>"二要素验证",
    "resgt3"=>"申请记录",
    "resgt4"=>"赊账记录",
    "resgt5"=>"关联申请记录",
    "resgt6"=>"法院失信名单",
    "resgt7"=>"法院执行名单",
    "resgt8"=>"风险联系人",
    "resgt9"=>"风险关注名单",

    "resgt10"=>"线上小额申请",
    "resgt11"=>"互联网渠道申请",
    "resgt12"=>"信用办卡平台",
    "resgt13"=>"线下渠道申请",
    "resgt14"=>"线下消费申请",
    "resgt15"=>"汽车消费申请",
    "resgt16"=>"消费赊账申请",
    "resgt17"=>"申请其他的次数",
    "resgt18"=>"大型实体机构申请",
];
function idcardYas($idcard){
    
    $birth = strlen($idcard)==15 ? ('19' . substr($idcard, 6, 6)) : substr($idcard, 6, 8);
    $b1=substr($birth, 0, 4);
    $b2=substr($birth, 4, 2);
    $b3=substr($birth, 6, 2);
    return [
        "year"=>$b1,
        "month"=>$b2,
        "day"=>$b3
    ];
}
//知识摘要类目
const _sidebarStudy = [
    "PHP", "HTML", "CSS", "JS"
];
function isMobile()
{
    return 0;
}
function extractDomainFromUrl($url) {
    $parsedUrl = parse_url($url);
    if (isset($parsedUrl['host'])) {
        return $parsedUrl['host'];
    }
    return null;
}

//保留两位小数
function decrto($n = 0)
{
    return sprintf("%01.2f", $n);
}

function returnmsg($code, $msg = "", $data = [], $ext = "")
{
    //code等于200正常   小于200与数据库无交互   大于200与数据库有交互
    return json(["code" => $code, "message" => $msg, "data" => $data, "ext" => $ext]);
}
function resmsg($code, $msg = "", $data = [], $count = "")
{
    //code等于0正常   
    return json(["code" => $code, "message" => $msg, "data" => $data, "count" => $count]);
}
function yzmobile($mobile)
{
    if (preg_match("/^1[3456789]{1}\d{9}$/", $mobile)) {
        return 1;
    } else {

        return 0;
    }
}
const _user_header_img_data = "default.jpg";
const _user_header_img = "/static/assets/img/avatars/adam-jansen.jpg";

//接收昵称时用到
function filter_Emoji($string)
{  //去除特殊符号
    $string = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $string);
    $string = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $string);
    $string = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $string);
    $string = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $string);
    $string = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $string);
    $string = preg_replace('/[\x{10000}-\x{10FFFF}]/u', '', $string);
    $string = str_replace(array('"', '\''), '', $string);
    return addslashes(trim($string));
}
function curlPost($url, $data = [], $header = [])
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    if ($header) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
    }
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}
